package com.jalarbee.stock.product.business;

import com.jalarbee.stock.store.business.Store;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import org.hibernate.annotations.Columns;
import org.hibernate.annotations.Type;

/**
 *
 * @author devel
 */
@Entity
public class ProductDistribution implements Serializable {

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private int id;
    @OneToOne(fetch=FetchType.LAZY)
    private Product product;
    @OneToOne(fetch=FetchType.LAZY)
    private Store store;
    @Type(type = "com.jalarbee.core.types.QuantityType")
    @Columns(columns= {
        @Column(name="A_SIZE"),
        @Column(name="A_UNIT")
    })
    private Quantity availabaleQuantity;

    @Type(type = "com.jalarbee.core.types.QuantityType")
    @Columns(columns= {
        @Column(name="T_SIZE"),
        @Column(name="T_UNIT")
    })
    private Quantity alertThreshold;

    @OneToOne(fetch=FetchType.LAZY, optional=true)
    private StorePricing storePricing;

    public Quantity getAlertThreshold() {
        return alertThreshold;
    }

    public void setAlertThreshold(Quantity alertThreshold) {
        this.alertThreshold = alertThreshold;
    }

    public Quantity getAvailabaleQuantity() {
        return availabaleQuantity;
    }

    public void setAvailabaleQuantity(Quantity availabaleQuantity) {
        this.availabaleQuantity = availabaleQuantity;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public Store getStore() {
        return store;
    }

    public void setStore(Store store) {
        this.store = store;
    }

}
